package com.yunji.coupon.enums;

import lombok.Getter;

/**
 * @author : peter-zhu
 * @date : 2024/10/25 17:30
 * @description : TODO
 **/
@Getter
public enum ReceiveRuleTypeEnum {
    NONE(1, "不限"),
    EVERY_TO_ONE(2, "每人限领x张"),
    EVERY_TO_DAY(3, "每人每天限领x张");
    private final Integer code;
    private final String desc;

    ReceiveRuleTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        ReceiveRuleTypeEnum[] values = ReceiveRuleTypeEnum.values();
        for (ReceiveRuleTypeEnum value : values) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return null;
    }
}
